package com.ruoyi.st.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * 票面日期对象 st_ticket_date
 * 
 * @author ruoyi
 * @date 2024-11-06
 */
public class StTicketDate extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    private Long id;

    /** 后台管理使用的日期格式 day */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
    private Date day;

    public Date getDay2() {
        return day2;
    }

    public void setDay2(Date day2) {
        this.day2 = day2;
    }

    /**
     * app使用的日期格式 day2
     */
    @JsonFormat(pattern = "MM.dd")
    @Excel(name = "日期2", width = 30, dateFormat = "MM.dd")
    private Date day2;

    /** 星期 */
    @Excel(name = "星期")
    private String weekDay;

    /** 星期 */
    @Excel(name = "时间")
    private String time;

    /** 是否有票 无票 有票 */
    @Excel(name = "是否有票 无票 有票")
    private String status;

    /** 无票  有票 */
    @Excel(name = "无票  有票")
    private Integer statusCode;

    /** ticket表外键 */
    @Excel(name = "ticket表外键")
    private Long ticketInfoId;


    public List<StTicketPrice> getTicketList() {
        return ticketList;
    }

    public void setTicketList(List<StTicketPrice> ticketList) {
        this.ticketList = ticketList;
    }

    private List<StTicketPrice> ticketList;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setDay(Date day) 
    {
        this.day = day;
    }

//    @JsonFormat(pattern = "MM.dd")
    public Date getDay() 
    {
        return day;
    }
    public void setStatus(String status) 
    {
        this.status = status;
    }

    public String getStatus() 
    {
        return status;
    }
    public void setStatusCode(Integer statusCode) 
    {
        this.statusCode = statusCode;
    }

    public String getWeekDay()
    {
        return weekDay;
    }
    public void setWeekDay(String weekDay)
    {
        this.weekDay = weekDay;
    }

    public String getTime()
    {
        return time;
    }
    public void setTime(String time)
    {
        this.time = time;
    }

    public Integer getStatusCode()
    {
        return statusCode;
    }
    public void setTicketInfoId(Long ticketInfoId) 
    {
        this.ticketInfoId = ticketInfoId;
    }

    public Long getTicketInfoId() 
    {
        return ticketInfoId;
    }

    @Override
    public String toString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("MM.dd");
        String day = dateFormat.format(getDay());
        return str(new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
                .append("id", getId()+",")
                .append("day", day+",")
                .append("status", getStatus()+",")
                .append("statusCode", getStatusCode()+",")
                .append("ticketInfoId", getTicketInfoId()+",")
                .append("weekDay", getWeekDay()+",")
                .append("time", getTime())
                .toString());

    }
    private String str(String data){
        // 找到第一个 '[' 的位置
        int firstBracket = data.indexOf('[');
        // 找到第二个 '[' 的位置
        int secondBracket = data.indexOf('[',  1);

        // 拼接字符串，去掉第一个 '[' 和第二个 '[' 之间的内容
        String cleanedData = data.substring(0, 0) + data.substring(secondBracket);
        return cleanedData;
    }
}
